<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>管理员修改用户信息</title>
</head>
<script src="/js/jquery/2.0.0/jquery.min.js"></script>
<link href="/css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="/js/bootstrap/3.3.6/bootstrap.min.js"></script>

<body>
<center>
    <style>
        div{
            margin:5px;
        }
    </style>
    <form action="/HTML/adminUpdateUserInfoTo" method="post" onsubmit="return judgePremission()">
        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-account">账号</span>
            <input type="text" class="form-control"  name="user.account" th:value="${user.account}" readonly>
        </div>

        <div class="input-group  col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-name">姓名</span>
            <input type="text" class="form-control"   name="user.name" th:placeholder="${user.name}" >
        </div>

        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-gender">性别</span>
            <input type="text" class="form-control"   name="user.gender" th:placeholder="${user.gender}" >
        </div>

        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-age">年龄</span>
            <input type="text" class="form-control"  name="user.age" th:placeholder="${user.age}">
        </div>

        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-phone">电话号码</span>
            <input type="text" class="form-control"    name="user.phone" th:placeholder="${user.phone}" >
        </div>

        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-mail">邮箱地址</span>
            <input type="text" class="form-control"    name="user.mail" th:placeholder="${user.mail}" >
        </div>
        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-role">角色</span>
            <input type="text" class="form-control"   name="user.role" th:placeholder="${user.role}" >
        </div>
        <div class="input-group col-md-3" th:each="user: ${user}">
            <span class="input-group-addon" id="basic-premission">权限</span>
            <input type="text" class="form-control"   name="user.premission" th:placeholder="${user.premission}" >
        </div>
        <div2>
            作为管理员，若您要修改具体信息，请在上面修改后，单击下面“确认修改”按钮
        </div2>
        <button type="submit"  class="btn btn-success" >确认修改</button>
    </form>
    <br>
    <table class="table table-striped">
        <p>该账号下的所有订单</p>
        <thead>
        <th>订单号</th>
        <th>账户</th>
        <th>酒店名字</th>
        <th>房间类型</th>
        <th>入住人数</th>
        <th>入住时间</th>
        <th>退房时间</th>
        <th>订单状态</th>
        <th>支付状态</th>
        <th>房号</th>
        <th>详情</th>
        </thead>
        <tbody>
        <tr th:each="order: ${orders}" >
            <td th:text="${order.orderId}"></td>
            <td th:text="${order.account}"></td>
            <td th:text="${order.hotelName}"></td>
            <td th:text="${order.roomType}"></td>
            <td th:text="${order.inNumber}"></td>
            <td th:text="${order.inTime}"></td>
            <td th:text="${order.outTime}"></td>
            <td th:text="${order.orderStatus}"></td>
            <td th:text="${order.paymentStatus}"></td>
            <td th:text="${order.roomNumber}"></td>

            <form action="/HTML/showOrderForAdmin" method="post" >
                <td class="col-md-1">
                    <input type="hidden" name="orderId" th:value="${order.orderId}" >
                    <button  class="btn btn-sm btn-primary " type="submit">查看</button>
                </td>
            </form>
        </tr>
        </tbody>
    </table>
    <!--<form name="form2" action="/HTML/home">-->
        <!--<button type="submit" class="btn btn-info">返回主页</button>-->
    <!--</form>-->
    <p style="margin:0px">&nbsp;</p>
</center>
<script >
    window.onload=function isupdate(){
        var data1=[[${isUpdate}]];
        if(data1=="0")
        {
            alert("修改成功");
        }
        else if(data1==1)
        {
            alert("修改失败");
        }
    }
    function judgePremission() {
        var adminPremission=[[${adminPremission}]];
        var userPremission=document.getElementById().value;
        alert(adminPremission);
        alert(userPremission);
        if(adminPremission<userPremission){
            alert("您的级别不够高啊！不能改这个用户的权限！");
            return false;
        }
        else{
            return true;
        }
    }
</script>
</body>
</html>